﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;

using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;


public partial class AdministratorManager : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            check_Role();
            load_RecordStatus();
            get_All_Administrator();
        }
    }

    public void check_Role()
    {
        string sUsername = Session["Username"].ToString();
        DataTable dtUsername = BusLogic.Administrator.get_ADMINISTRATOR(sUsername).Tables[0];

        int iRole = int.Parse(dtUsername.Rows[0]["ROLE"].ToString());

        if (iRole != 1)
        {
            Response.Redirect("DesignManager.aspx");
        }
    }

    public void get_All_Administrator()
    {
        AdministratorRepeater.DataSource = BusLogic.Administrator.get_ALL_ADMINISTRATOR();
        AdministratorRepeater.DataBind();
    }

    public void load_RecordStatus()
    {
        ListItem item = new ListItem();

        item.Value = "True";
        item.Text = "Công bố";
        item.Selected = true;
        rdlRecordStatus.Items.Add(item);

        item = new ListItem();
        item.Value = "False";
        item.Text = "Chờ";
        rdlRecordStatus.Items.Add(item);
    }
}
